Source analysis using the DICS beamformer
Background
...
Requirements
The FIFF-file with the raw data:
training_raw-1.fif training_raw-2.fif
Sensors and trials left from Artifact rejection:
chan_keep.mattrl_keep.mat trl_keep2.mat
The ICA projection from Artifact suppression by ICA:
planar_comp.mat
The trial function:
ft_trialfun_general.m
Preparing the data
dataset{1,1} = 'training_raw-1.fif';
dataset{1,2} = 'training_raw-2.fif';
cfg.dataset = char(dataset{1,i});
cfg.trialfun = 'ft_trialfun_general';
cfg.trialdef.eventtype = 'STI101';
cfg.trialdef.eventvalue = [21 22];
cfg.trialdef.prestim = 2.5;
cfg.trialdef.poststim = 2;
cfg = ft_definetrial(cfg);
cfg.channel = {'MEGGRAD'};
data(i,1) = ft_preprocessing(cfg);
end
evaluating trialfunction 'ft_trialfun_general'
reading the header from 'training_raw-1.fif'
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
306 MEG channel locations transformed
Reading training_raw-1.fif ...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Opening raw data file training_raw-1.fif...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Range : 208000 ... 1664999 = 208.000 ... 1664.999 secs
Ready.
Warning: assuming that the default scaling should be amplitude/distance rather than amplitude
reading the events from 'training_raw-1.fif'
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
306 MEG channel locations transformed
Reading training_raw-1.fif ...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Opening raw data file training_raw-1.fif...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Range : 208000 ... 1664999 = 208.000 ... 1664.999 secs
Ready.
Reading 208000 ... 1664999 = 208.000 ... 1664.999 secs... [done]
Reading 208000 ... 1664999 = 208.000 ... 1664.999 secs... [done]
Fixing trigger at sample 331854
Fixing trigger at sample 838423
found 3359 events
created 139 trials
the call to "ft_definetrial" took 17 seconds
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
306 MEG channel locations transformed
Reading training_raw-1.fif ...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Opening raw data file training_raw-1.fif...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Range : 208000 ... 1664999 = 208.000 ... 1664.999 secs
Ready.
processing channel { 'MEG0112' 'MEG0113' 'MEG0122' 'MEG0123' 'MEG0132' 'MEG0133' 'MEG0142' 'MEG0143' 'MEG0212' 'MEG0213' 'MEG0222' 'MEG0223' 'MEG0232' 'MEG0233' 'MEG0242' 'MEG0243' 'MEG0312' 'MEG0313' 'MEG0322' 'MEG0323' 'MEG0332' 'MEG0333' 'MEG0342' 'MEG0343' 'MEG0412' 'MEG0413' 'MEG0422' 'MEG0423' 'MEG0432' 'MEG0433' 'MEG0442' 'MEG0443' 'MEG0512' 'MEG0513' 'MEG0522' 'MEG0523' 'MEG0532' 'MEG0533' 'MEG0542' 'MEG0543' 'MEG0612' 'MEG0613' 'MEG0622' 'MEG0623' 'MEG0632' 'MEG0633' 'MEG0642' 'MEG0643' 'MEG0712' 'MEG0713' 'MEG0722' 'MEG0723' 'MEG0732' 'MEG0733' 'MEG0742' 'MEG0743' 'MEG0812' 'MEG0813' 'MEG0822' 'MEG0823' 'MEG0912' 'MEG0913' 'MEG0922' 'MEG0923' 'MEG0932' 'MEG0933' 'MEG0942' 'MEG0943' 'MEG1012' 'MEG1013' 'MEG1022' 'MEG1023' 'MEG1032' 'MEG1033' 'MEG1042' 'MEG1043' 'MEG1112' 'MEG1113' 'MEG1122' 'MEG1123' 'MEG1132' 'MEG1133' 'MEG1142' 'MEG1143' 'MEG1212' 'MEG1213' 'MEG1222' 'MEG1223' 'MEG1232' 'MEG1233' 'MEG1242' 'MEG1243' 'MEG1312' 'MEG1313' 'MEG1322' 'MEG1323' 'MEG1332' 'MEG1333' 'MEG1342' 'MEG1343' 'MEG1412' 'MEG1413' 'MEG1422' 'MEG1423' 'MEG1432' 'MEG1433' 'MEG1442' 'MEG1443' 'MEG1512' 'MEG1513' 'MEG1522' 'MEG1523' 'MEG1532' 'MEG1533' 'MEG1542' 'MEG1543' 'MEG1612' 'MEG1613' 'MEG1622' 'MEG1623' 'MEG1632' 'MEG1633' 'MEG1642' 'MEG1643' 'MEG1712' 'MEG1713' 'MEG1722' 'MEG1723' 'MEG1732' 'MEG1733' 'MEG1742' 'MEG1743' 'MEG1812' 'MEG1813' 'MEG1822' 'MEG1823' 'MEG1832' 'MEG1833' 'MEG1842' 'MEG1843' 'MEG1912' 'MEG1913' 'MEG1922' 'MEG1923' 'MEG1932' 'MEG1933' 'MEG1942' 'MEG1943' 'MEG2012' 'MEG2013' 'MEG2022' 'MEG2023' 'MEG2032' 'MEG2033' 'MEG2042' 'MEG2043' 'MEG2112' 'MEG2113' 'MEG2122' 'MEG2123' 'MEG2132' 'MEG2133' 'MEG2142' 'MEG2143' 'MEG2212' 'MEG2213' 'MEG2222' 'MEG2223' 'MEG2232' 'MEG2233' 'MEG2242' 'MEG2243' 'MEG2312' 'MEG2313' 'MEG2322' 'MEG2323' 'MEG2332' 'MEG2333' 'MEG2342' 'MEG2343' 'MEG2412' 'MEG2413' 'MEG2422' 'MEG2423' 'MEG2432' 'MEG2433' 'MEG2442' 'MEG2443' 'MEG2512' 'MEG2513' 'MEG2522' 'MEG2523' 'MEG2532' 'MEG2533' 'MEG2542' 'MEG2543' 'MEG2612' 'MEG2613' 'MEG2622' 'MEG2623' 'MEG2632' 'MEG2633' 'MEG2642' 'MEG2643' }
reading and preprocessing
Reading 232279 ... 236778 = 232.279 ... 236.778 secs... [done]
reading and preprocessing trial 2 from 139
Reading 239077 ... 243576 reading and preprocessing trial 3 from 139
Reading 246925 ... 251424 reading and preprocessing trial 4 from 139
Reading 254139 ... 258638 reading and preprocessing trial 5 from 139
Reading 262922 ... 267421 reading and preprocessing trial 6 from 139
Reading 270953 ... 275452 reading and preprocessing trial 7 from 139
Reading 279052 ... 283551 reading and preprocessing trial 8 from 139
Reading 288151 ... 292650 = 288.151 ... 292.650 secs... [done]
Reading 297250 ... 301749 reading and preprocessing trial 10 from 139
Reading 304073 ... 308572 = 304.073 ... 308.572 secs... [done]
Reading 310987 ... 315486reading and preprocessing trial 12 from 139
Reading 318952 ... 323451reading and preprocessing trial 13 from 139
Reading 327685 ... 332184reading and preprocessing trial 14 from 139
Reading 336942 ... 341441 = 336.942 ... 341.441 secs... [done]
Reading 344966 ... 349465reading and preprocessing trial 16 from 139
Reading 353873 ... 358372reading and preprocessing trial 17 from 139
Reading 362839 ... 367338reading and preprocessing trial 18 from 139
Reading 369803 ... 374302 = 369.803 ... 374.302 secs... [done]
Reading 377435 ... 381934reading and preprocessing trial 20 from 139
Reading 386368 ... 390867reading and preprocessing trial 21 from 139
Reading 394191 ... 398690 = 394.191 ... 398.690 secs... [done]
Reading 402289 ... 406788reading and preprocessing trial 23 from 139
Reading 411547 ... 416046reading and preprocessing trial 24 from 139
Reading 419604 ... 424103reading and preprocessing trial 25 from 139
Reading 426835 ... 431334reading and preprocessing trial 26 from 139
Reading 434416 ... 438915reading and preprocessing trial 27 from 139
Reading 453674 ... 458173 = 453.674 ... 458.173 secs... [done]
Reading 462565 ... 467064reading and preprocessing trial 29 from 139
Reading 471823 ... 476322reading and preprocessing trial 30 from 139
Reading 481081 ... 485580reading and preprocessing trial 31 from 139
Reading 490047 ... 494546reading and preprocessing trial 32 from 139
Reading 498771 ... 503270reading and preprocessing trial 33 from 139
Reading 505835 ... 510334reading and preprocessing trial 34 from 139
Reading 514784 ... 519283reading and preprocessing trial 35 from 139
Reading 523667 ... 528166reading and preprocessing trial 36 from 139
Reading 530839 ... 535338 = 530.839 ... 535.338 secs... [done]
Reading 538571 ... 543070reading and preprocessing trial 38 from 139
Reading 546761 ... 551260 = 546.761 ... 551.260 secs... [done]
Reading 554668 ... 559167reading and preprocessing trial 40 from 139
Reading 562858 ... 567357 = 562.858 ... 567.357 secs... [done]
Reading 570473 ... 574972reading and preprocessing trial 42 from 139
Reading 577787 ... 582286 = 577.787 ... 582.286 secs... [done]
Reading 585752 ... 590251reading and preprocessing trial 44 from 139
Reading 593059 ... 597558reading and preprocessing trial 45 from 139
Reading 600073 ... 604572reading and preprocessing trial 46 from 139
Reading 608980 ... 613479reading and preprocessing trial 47 from 139
Reading 617863 ... 622362reading and preprocessing trial 48 from 139
Reading 626562 ... 631061 = 626.562 ... 631.061 secs... [done]
Reading 634293 ... 638792reading and preprocessing trial 50 from 139
Reading 643159 ... 647658reading and preprocessing trial 51 from 139
Reading 650891 ... 655390reading and preprocessing trial 52 from 139
Reading 658005 ... 662504reading and preprocessing trial 53 from 139
Reading 695220 ... 699719 = 695.220 ... 699.719 secs... [done]
Reading 704211 ... 708710reading and preprocessing trial 55 from 139
Reading 713135 ... 717634reading and preprocessing trial 56 from 139
Reading 721434 ... 725933reading and preprocessing trial 57 from 139
Reading 730358 ... 734857 = 730.358 ... 734.857 secs... [done]
Reading 737389 ... 741888reading and preprocessing trial 59 from 139
Reading 744920 ... 749419reading and preprocessing trial 60 from 139
Reading 751809 ... 756308reading and preprocessing trial 61 from 139
Reading 760558 ... 765057reading and preprocessing trial 62 from 139
Reading 768965 ... 773464 = 768.965 ... 773.464 secs... [done]
Reading 777898 ... 782397reading and preprocessing trial 64 from 139
Reading 786922 ... 791421reading and preprocessing trial 65 from 139
Reading 795229 ... 799728reading and preprocessing trial 66 from 139
Reading 803203 ... 807702 = 803.203 ... 807.702 secs... [done]
Reading 811952 ... 816451reading and preprocessing trial 68 from 139
Reading 820718 ... 825217reading and preprocessing trial 69 from 139
Reading 829442 ... 833941 = 829.442 ... 833.941 secs... [done]
Reading 838699 ... 843198reading and preprocessing trial 71 from 139
Reading 847690 ... 852189reading and preprocessing trial 72 from 139
Reading 855605 ... 860104reading and preprocessing trial 73 from 139
Reading 864354 ... 868853reading and preprocessing trial 74 from 139
Reading 873045 ... 877544 = 873.045 ... 877.544 secs... [done]
Reading 881402 ... 885901reading and preprocessing trial 76 from 139
Reading 888900 ... 893399reading and preprocessing trial 77 from 139
Reading 898158 ... 902657reading and preprocessing trial 78 from 139
Reading 906506 ... 911005reading and preprocessing trial 79 from 139
Reading 963354 ... 967853 = 963.354 ... 967.853 secs... [done]
Reading 972437 ... 976936reading and preprocessing trial 81 from 139
Reading 980444 ... 984943 = 980.444 ... 984.943 secs... [done]
Reading 989702 ... 994201reading and preprocessing trial 83 from 139
Reading 998042 ... 1002541reading and preprocessing trial 84 from 139
Reading 1005115 ... 1009614reading and preprocessing trial 85 from 139
Reading 1013555 ... 1018054 = 1013.555 ... 1018.054 secs... [done]
Reading 1020878 ... 1025377reading and preprocessing trial 87 from 139
Reading 1028968 ... 1033467reading and preprocessing trial 88 from 139
Reading 1036558 ... 1041057 = 1036.558 ... 1041.057 secs... [done]
Reading 1043923 ... 1048422reading and preprocessing trial 90 from 139
Reading 1052355 ... 1056854reading and preprocessing trial 91 from 139
Reading 1060620 ... 1065119reading and preprocessing trial 92 from 139
Reading 1069878 ... 1074377reading and preprocessing trial 93 from 139
Reading 1078393 ... 1082892 = 1078.393 ... 1082.892 secs... [done]
Reading 1087126 ... 1091625reading and preprocessing trial 95 from 139
Reading 1094574 ... 1099073 = 1094.574 ... 1099.073 secs... [done]
Reading 1102756 ... 1107255reading and preprocessing trial 97 from 139
Reading 1110662 ... 1115161reading and preprocessing trial 98 from 139
Reading 1118561 ... 1123060reading and preprocessing trial 99 from 139
Reading 1125942 ... 1130441reading and preprocessing trial 100 from 139
Reading 1134883 ... 1139382 = 1134.883 ... 1139.382 secs... [done]
Reading 1143632 ... 114813reading and preprocessing trial 102 from 139
Reading 1150938 ... 115543reading and preprocessing trial 103 from 139
Reading 1159804 ... 116430reading and preprocessing trial 104 from 139
Reading 1168895 ... 117339reading and preprocessing trial 105 from 139
Reading 1380215 ... 138471reading and preprocessing trial 106 from 139
Reading 1388363 ... 1392862 = 1388.363 ... 1392.862 secs... [done]
Reading 1396562 ... 140106reading and preprocessing trial 108 from 139
Reading 1405820 ... 141031reading and preprocessing trial 109 from 139
Reading 1414736 ... 1419235 = 1414.736 ... 1419.235 secs... [done]
Reading 1423993 ... 142849reading and preprocessing trial 111 from 139
Reading 1432217 ... 143671reading and preprocessing trial 112 from 139
Reading 1439290 ... 1443789 = 1439.290 ... 1443.789 secs... [done]
Reading 1446220 ... 145071reading and preprocessing trial 114 from 139
Reading 1453068 ... 1457567 = 1453.068 ... 1457.567 secs... [done]
Reading 1461500 ... 146599reading and preprocessing trial 116 from 139
Reading 1468356 ... 147285reading and preprocessing trial 117 from 139
Reading 1475996 ... 148049reading and preprocessing trial 118 from 139
Reading 1484444 ... 148894reading and preprocessing trial 119 from 139
Reading 1491083 ... 1495582 = 1491.083 ... 1495.582 secs... [done]
Reading 1498198 ... 150269reading and preprocessing trial 121 from 139
Reading 1505229 ... 150972reading and preprocessing trial 122 from 139
Reading 1512360 ... 151685reading and preprocessing trial 123 from 139
Reading 1520792 ... 152529reading and preprocessing trial 124 from 139
Reading 1527581 ... 153208reading and preprocessing trial 125 from 139
Reading 1534328 ... 153882reading and preprocessing trial 126 from 139
Reading 1541509 ... 154600reading and preprocessing trial 127 from 139
Reading 1549141 ... 155364reading and preprocessing trial 128 from 139
Reading 1557439 ... 1561938 = 1557.439 ... 1561.938 secs... [done]
Reading 1565888 ... 157038reading and preprocessing trial 130 from 139
Reading 1574863 ... 157936reading and preprocessing trial 131 from 139
Reading 1590926 ... 159542reading and preprocessing trial 132 from 139
Reading 1597815 ... 160231reading and preprocessing trial 133 from 139
Reading 1605964 ... 161046reading and preprocessing trial 134 from 139
Reading 1612853 ... 161735reading and preprocessing trial 135 from 139
Reading 1620993 ... 162549reading and preprocessing trial 136 from 139
Reading 1629525 ... 163402reading and preprocessing trial 137 from 139
Reading 1636606 ... 164110reading and preprocessing trial 138 from 139
Reading 1643737 ... 164823reading and preprocessing trial 139 from 139
Reading 1652995 ... 1657494 = 1652.995 ... 1657.494 secs... [done]
the call to "ft_preprocessing" took 16 seconds
evaluating trialfunction 'ft_trialfun_general'
reading the header from 'training_raw-2.fif'
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
306 MEG channel locations transformed
Reading training_raw-2.fif ...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Opening raw data file training_raw-2.fif...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Range : 1665000 ... 3098999 = 1665.000 ... 3098.999 secs
Ready.
reading the events from 'training_raw-2.fif'
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
306 MEG channel locations transformed
Reading training_raw-2.fif ...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Opening raw data file training_raw-2.fif...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Range : 1665000 ... 3098999 = 1665.000 ... 3098.999 secs
Ready.
Reading 1665000 ... 3098999 = 1665.000 ... 3098.999 secs... [done]
Reading 1665000 ... 3098999 = 1665.000 ... 3098.999 secs... [done]
found 4129 events
created 172 trials
the call to "ft_definetrial" took 16 seconds
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
306 MEG channel locations transformed
Reading training_raw-2.fif ...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Opening raw data file training_raw-2.fif...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Range : 1665000 ... 3098999 = 1665.000 ... 3098.999 secs
Ready.
processing channel { 'MEG0112' 'MEG0113' 'MEG0122' 'MEG0123' 'MEG0132' 'MEG0133' 'MEG0142' 'MEG0143' 'MEG0212' 'MEG0213' 'MEG0222' 'MEG0223' 'MEG0232' 'MEG0233' 'MEG0242' 'MEG0243' 'MEG0312' 'MEG0313' 'MEG0322' 'MEG0323' 'MEG0332' 'MEG0333' 'MEG0342' 'MEG0343' 'MEG0412' 'MEG0413' 'MEG0422' 'MEG0423' 'MEG0432' 'MEG0433' 'MEG0442' 'MEG0443' 'MEG0512' 'MEG0513' 'MEG0522' 'MEG0523' 'MEG0532' 'MEG0533' 'MEG0542' 'MEG0543' 'MEG0612' 'MEG0613' 'MEG0622' 'MEG0623' 'MEG0632' 'MEG0633' 'MEG0642' 'MEG0643' 'MEG0712' 'MEG0713' 'MEG0722' 'MEG0723' 'MEG0732' 'MEG0733' 'MEG0742' 'MEG0743' 'MEG0812' 'MEG0813' 'MEG0822' 'MEG0823' 'MEG0912' 'MEG0913' 'MEG0922' 'MEG0923' 'MEG0932' 'MEG0933' 'MEG0942' 'MEG0943' 'MEG1012' 'MEG1013' 'MEG1022' 'MEG1023' 'MEG1032' 'MEG1033' 'MEG1042' 'MEG1043' 'MEG1112' 'MEG1113' 'MEG1122' 'MEG1123' 'MEG1132' 'MEG1133' 'MEG1142' 'MEG1143' 'MEG1212' 'MEG1213' 'MEG1222' 'MEG1223' 'MEG1232' 'MEG1233' 'MEG1242' 'MEG1243' 'MEG1312' 'MEG1313' 'MEG1322' 'MEG1323' 'MEG1332' 'MEG1333' 'MEG1342' 'MEG1343' 'MEG1412' 'MEG1413' 'MEG1422' 'MEG1423' 'MEG1432' 'MEG1433' 'MEG1442' 'MEG1443' 'MEG1512' 'MEG1513' 'MEG1522' 'MEG1523' 'MEG1532' 'MEG1533' 'MEG1542' 'MEG1543' 'MEG1612' 'MEG1613' 'MEG1622' 'MEG1623' 'MEG1632' 'MEG1633' 'MEG1642' 'MEG1643' 'MEG1712' 'MEG1713' 'MEG1722' 'MEG1723' 'MEG1732' 'MEG1733' 'MEG1742' 'MEG1743' 'MEG1812' 'MEG1813' 'MEG1822' 'MEG1823' 'MEG1832' 'MEG1833' 'MEG1842' 'MEG1843' 'MEG1912' 'MEG1913' 'MEG1922' 'MEG1923' 'MEG1932' 'MEG1933' 'MEG1942' 'MEG1943' 'MEG2012' 'MEG2013' 'MEG2022' 'MEG2023' 'MEG2032' 'MEG2033' 'MEG2042' 'MEG2043' 'MEG2112' 'MEG2113' 'MEG2122' 'MEG2123' 'MEG2132' 'MEG2133' 'MEG2142' 'MEG2143' 'MEG2212' 'MEG2213' 'MEG2222' 'MEG2223' 'MEG2232' 'MEG2233' 'MEG2242' 'MEG2243' 'MEG2312' 'MEG2313' 'MEG2322' 'MEG2323' 'MEG2332' 'MEG2333' 'MEG2342' 'MEG2343' 'MEG2412' 'MEG2413' 'MEG2422' 'MEG2423' 'MEG2432' 'MEG2433' 'MEG2442' 'MEG2443' 'MEG2512' 'MEG2513' 'MEG2522' 'MEG2523' 'MEG2532' 'MEG2533' 'MEG2542' 'MEG2543' 'MEG2612' 'MEG2613' 'MEG2622' 'MEG2623' 'MEG2632' 'MEG2633' 'MEG2642' 'MEG2643' }
reading and preprocessing
Reading 1668483 ... 1672982 = 1668.483 ... 1672.982 secs... [done]
reading and preprocessing trial 2 from 172
Reading 1675214 ... 1679713 = 1675.214 ... 1679.713 secs... [done]
Reading 1681978 ... 1686477 reading and preprocessing trial 4 from 172
Reading 1689142 ... 1693641 = 1689.142 ... 1693.641 secs... [done]
Reading 1696390 ... 1700889 reading and preprocessing trial 6 from 172
Reading 1703221 ... 1707720 reading and preprocessing trial 7 from 172
Reading 1710310 ... 1714809 = 1710.310 ... 1714.809 secs... [done]
Reading 1719293 ... 1723792 reading and preprocessing trial 9 from 172
Reading 1726349 ... 1730848 = 1726.349 ... 1730.848 secs... [done]
Reading 1733697 ... 1738196 reading and preprocessing trial 11 from 172
Reading 1742637 ... 1747136reading and preprocessing trial 12 from 172
Reading 1751895 ... 1756394reading and preprocessing trial 13 from 172
Reading 1758901 ... 1763400reading and preprocessing trial 14 from 172
Reading 1767400 ... 1771899reading and preprocessing trial 15 from 172
Reading 1774381 ... 1778880reading and preprocessing trial 16 from 172
Reading 1781187 ... 1785686reading and preprocessing trial 17 from 172
Reading 1805949 ... 1810448 = 1805.949 ... 1810.448 secs... [done]
Reading 1815049 ... 1819548reading and preprocessing trial 19 from 172
Reading 1822155 ... 1826654reading and preprocessing trial 20 from 172
Reading 1830920 ... 1835419reading and preprocessing trial 21 from 172
Reading 1838068 ... 1842567reading and preprocessing trial 22 from 172
Reading 1845182 ... 1849681reading and preprocessing trial 23 from 172
Reading 1854123 ... 1858622reading and preprocessing trial 24 from 172
Reading 1863064 ... 1867563reading and preprocessing trial 25 from 172
Reading 1870187 ... 1874686reading and preprocessing trial 26 from 172
Reading 1877251 ... 1881750reading and preprocessing trial 27 from 172
Reading 1885083 ... 1889582 = 1885.083 ... 1889.582 secs... [done]
Reading 1894340 ... 1898839reading and preprocessing trial 29 from 172
Reading 1902189 ... 1906688 = 1902.189 ... 1906.688 secs... [done]
Reading 1910963 ... 1915462reading and preprocessing trial 31 from 172
Reading 1918077 ... 1922576 = 1918.077 ... 1922.576 secs... [done]
Reading 1926726 ... 1931225reading and preprocessing trial 33 from 172
Reading 1935742 ... 1940241reading and preprocessing trial 34 from 172
Reading 1943632 ... 1948131reading and preprocessing trial 35 from 172
Reading 1950763 ... 1955262reading and preprocessing trial 36 from 172
Reading 1959446 ... 1963945reading and preprocessing trial 37 from 172
Reading 1966743 ... 1971242reading and preprocessing trial 38 from 172
Reading 1976001 ... 1980500reading and preprocessing trial 39 from 172
Reading 1984967 ... 1989466reading and preprocessing trial 40 from 172
Reading 1992165 ... 1996664reading and preprocessing trial 41 from 172
Reading 1999980 ... 2004479reading and preprocessing trial 42 from 172
Reading 2009054 ... 2013553reading and preprocessing trial 43 from 172
Reading 2023716 ... 2028215reading and preprocessing trial 44 from 172
Reading 2031214 ... 2035713reading and preprocessing trial 45 from 172
Reading 2038162 ... 2042661 = 2038.162 ... 2042.661 secs... [done]
Reading 2045877 ... 2050376reading and preprocessing trial 47 from 172
Reading 2053475 ... 2057974reading and preprocessing trial 48 from 172
Reading 2062207 ... 2066706reading and preprocessing trial 49 from 172
Reading 2070097 ... 2074596reading and preprocessing trial 50 from 172
Reading 2076861 ... 2081360reading and preprocessing trial 51 from 172
Reading 2084493 ... 2088992 = 2084.493 ... 2088.992 secs... [done]
Reading 2091532 ... 2096031reading and preprocessing trial 53 from 172
Reading 2100790 ... 2105289reading and preprocessing trial 54 from 172
Reading 2107504 ... 2112003reading and preprocessing trial 55 from 172
Reading 2115194 ... 2119693reading and preprocessing trial 56 from 172
Reading 2123968 ... 2128467reading and preprocessing trial 57 from 172
Reading 2131724 ... 2136223reading and preprocessing trial 58 from 172
Reading 2140515 ... 2145014reading and preprocessing trial 59 from 172
Reading 2148088 ... 2152587reading and preprocessing trial 60 from 172
Reading 2155870 ... 2160369reading and preprocessing trial 61 from 172
Reading 2163810 ... 2168309reading and preprocessing trial 62 from 172
Reading 2170799 ... 2175298reading and preprocessing trial 63 from 172
Reading 2180057 ... 2184556reading and preprocessing trial 64 from 172
Reading 2187855 ... 2192354reading and preprocessing trial 65 from 172
Reading 2195578 ... 2200077reading and preprocessing trial 66 from 172
Reading 2202776 ... 2207275reading and preprocessing trial 67 from 172
Reading 2210341 ... 2214840 = 2210.341 ... 2214.840 secs... [done]
Reading 2219056 ... 2223555reading and preprocessing trial 69 from 172
Reading 2233744 ... 2238243reading and preprocessing trial 70 from 172
Reading 2241050 ... 2245549reading and preprocessing trial 71 from 172
Reading 2249999 ... 2254498 = 2249.999 ... 2254.498 secs... [done]
Reading 2257489 ... 2261988reading and preprocessing trial 73 from 172
Reading 2265254 ... 2269753 = 2265.254 ... 2269.753 secs... [done]
Reading 2274161 ... 2278660reading and preprocessing trial 75 from 172
Reading 2282927 ... 2287426reading and preprocessing trial 76 from 172
Reading 2291209 ... 2295708reading and preprocessing trial 77 from 172
Reading 2298598 ... 2303097reading and preprocessing trial 78 from 172
Reading 2307414 ... 2311913reading and preprocessing trial 79 from 172
Reading 2315538 ... 2320037reading and preprocessing trial 80 from 172
Reading 2322944 ... 2327443reading and preprocessing trial 81 from 172
Reading 2330892 ... 2335391reading and preprocessing trial 82 from 172
Reading 2338841 ... 2343340reading and preprocessing trial 83 from 172
Reading 2347406 ... 2351905reading and preprocessing trial 84 from 172
Reading 2356664 ... 2361163reading and preprocessing trial 85 from 172
Reading 2365513 ... 2370012reading and preprocessing trial 86 from 172
Reading 2373553 ... 2378052reading and preprocessing trial 87 from 172
Reading 2381835 ... 2386334 = 2381.835 ... 2386.334 secs... [done]
Reading 2389992 ... 2394491reading and preprocessing trial 89 from 172
Reading 2397273 ... 2401772reading and preprocessing trial 90 from 172
Reading 2406531 ... 2411030reading and preprocessing trial 91 from 172
Reading 2415364 ... 2419863 = 2415.364 ... 2419.863 secs... [done]
Reading 2423946 ... 2428445reading and preprocessing trial 93 from 172
Reading 2431461 ... 2435960reading and preprocessing trial 94 from 172
Reading 2439509 ... 2444008reading and preprocessing trial 95 from 172
Reading 2454597 ... 2459096reading and preprocessing trial 96 from 172
Reading 2462370 ... 2466869reading and preprocessing trial 97 from 172
Reading 2470785 ... 2475284reading and preprocessing trial 98 from 172
Reading 2478784 ... 2483283reading and preprocessing trial 99 from 172
Reading 2487274 ... 2491773 = 2487.274 ... 2491.773 secs... [done]
Reading 2495631 ... 2500130reading and preprocessing trial 101 from 172
Reading 2504739 ... 250923reading and preprocessing trial 102 from 172
Reading 2511620 ... 251611reading and preprocessing trial 103 from 172
Reading 2520878 ... 252537reading and preprocessing trial 104 from 172
Reading 2528659 ... 253315reading and preprocessing trial 105 from 172
Reading 2537801 ... 254230reading and preprocessing trial 106 from 172
Reading 2546483 ... 255098reading and preprocessing trial 107 from 172
Reading 2554414 ... 255891reading and preprocessing trial 108 from 172
Reading 2562396 ... 256689reading and preprocessing trial 109 from 172
Reading 2569119 ... 2573618 = 2569.119 ... 2573.618 secs... [done]
Reading 2578251 ... 258275reading and preprocessing trial 111 from 172
Reading 2586717 ... 259121reading and preprocessing trial 112 from 172
Reading 2595791 ... 260029reading and preprocessing trial 113 from 172
Reading 2604282 ... 260878reading and preprocessing trial 114 from 172
Reading 2612230 ... 261672reading and preprocessing trial 115 from 172
Reading 2620720 ... 262521reading and preprocessing trial 116 from 172
Reading 2627626 ... 263212reading and preprocessing trial 117 from 172
Reading 2634399 ... 263889reading and preprocessing trial 118 from 172
Reading 2642714 ... 264721reading and preprocessing trial 119 from 172
Reading 2651972 ... 265647reading and preprocessing trial 120 from 172
Reading 2660638 ... 266513reading and preprocessing trial 121 from 172
Reading 2675975 ... 268047reading and preprocessing trial 122 from 172
Reading 2684724 ... 268922reading and preprocessing trial 123 from 172
Reading 2692331 ... 269683reading and preprocessing trial 124 from 172
Reading 2700504 ... 270500reading and preprocessing trial 125 from 172
Reading 2708653 ... 271315reading and preprocessing trial 126 from 172
Reading 2716968 ... 272146reading and preprocessing trial 127 from 172
Reading 2724958 ... 272945reading and preprocessing trial 128 from 172
Reading 2731789 ... 273628reading and preprocessing trial 129 from 172
Reading 2740513 ... 274501reading and preprocessing trial 130 from 172
Reading 2748462 ... 275296reading and preprocessing trial 131 from 172
Reading 2756485 ... 276098reading and preprocessing trial 132 from 172
Reading 2764133 ... 276863reading and preprocessing trial 133 from 172
Reading 2771681 ... 277618reading and preprocessing trial 134 from 172
Reading 2778512 ... 278301reading and preprocessing trial 135 from 172
Reading 2786235 ... 279073reading and preprocessing trial 136 from 172
Reading 2794584 ... 279908reading and preprocessing trial 137 from 172
Reading 2803842 ... 280834reading and preprocessing trial 138 from 172
Reading 2812024 ... 281652reading and preprocessing trial 139 from 172
Reading 2819738 ... 282423reading and preprocessing trial 140 from 172
Reading 2828487 ... 283298reading and preprocessing trial 141 from 172
Reading 2836803 ... 284130reading and preprocessing trial 142 from 172
Reading 2844534 ... 284903reading and preprocessing trial 143 from 172
Reading 2853792 ... 285829reading and preprocessing trial 144 from 172
Reading 2861857 ... 286635reading and preprocessing trial 145 from 172
Reading 2870656 ... 287515reading and preprocessing trial 146 from 172
Reading 2879380 ... 2883879 = 2879.380 ... 2883.879 secs... [done]
Reading 2893667 ... 289816reading and preprocessing trial 148 from 172
Reading 2901090 ... 290558reading and preprocessing trial 149 from 172
Reading 2909706 ... 291420reading and preprocessing trial 150 from 172
Reading 2916645 ... 292114reading and preprocessing trial 151 from 172
Reading 2923634 ... 292813reading and preprocessing trial 152 from 172
Reading 2930382 ... 293488reading and preprocessing trial 153 from 172
Reading 2937246 ... 294174reading and preprocessing trial 154 from 172
Reading 2945828 ... 295032reading and preprocessing trial 155 from 172
Reading 2952534 ... 295703reading and preprocessing trial 156 from 172
Reading 2959440 ... 296393reading and preprocessing trial 157 from 172
Reading 2968456 ... 297295reading and preprocessing trial 158 from 172
Reading 2977497 ... 298199reading and preprocessing trial 159 from 172
Reading 2984511 ... 298901reading and preprocessing trial 160 from 172
Reading 2991617 ... 299611reading and preprocessing trial 161 from 172
Reading 3000875 ... 300537reading and preprocessing trial 162 from 172
Reading 3008122 ... 301262reading and preprocessing trial 163 from 172
Reading 3017380 ... 302187reading and preprocessing trial 164 from 172
Reading 3024294 ... 302879reading and preprocessing trial 165 from 172
Reading 3031200 ... 303569reading and preprocessing trial 166 from 172
Reading 3039791 ... 304429reading and preprocessing trial 167 from 172
Reading 3048440 ... 305293reading and preprocessing trial 168 from 172
Reading 3055888 ... 306038reading and preprocessing trial 169 from 172
Reading 3064653 ... 306915reading and preprocessing trial 170 from 172
Reading 3071785 ... 307628reading and preprocessing trial 171 from 172
Reading 3078957 ... 308345reading and preprocessing trial 172 from 172
Reading 3087731 ... 3092230 = 3087.731 ... 3092.230 secs... [done]
the call to "ft_preprocessing" took 20 seconds
data_planar=ft_appenddata(cfg,data(1,1),data(2,1));
concatenating over the "rpt" dimension
the call to "ft_selectdata" took 0 seconds
the call to "ft_appenddata" took 0 seconds
planar_rjv1=ft_selectdata(cfg,data_planar);
the call to "ft_selectdata" took 1 seconds
planar_ica = ft_rejectcomponent(cfg, planar_comp, planar_rjv1);
undoing the comp balancing for the gradiometer definition
Warning: assuming that planar MEG channel units are T/cm
Warning: assuming that planar MEG channel units are T/cm
baseline correcting data
removing 2 components
keeping 201 components
processing trials
processing trial 287 from 287
also applying the backprojection matrix to the grad structure
Warning: copying input chantype to montage
Warning: copying input chanunit to montage
the call to "ft_rejectcomponent" took 7 seconds
Co-registering
For co-registering the MEG data and the anatomical MRI scan, you will need to specify the MEG dataset (one datafile is enough) and the dicom file (any dcm file of the T1 scan will do).
megfile='training_raw-1.fif';
mrifile='E:\Standard_Pipeline\Current version\20190228_0910_dicom\T1_biobank_normal_5\00001.dcm';
Next, we will read the anatomical mri scan in.
mri = ft_read_mri(mrifile)
INFO: Found 210 files in E:\Standard_Pipeline\Current version\20190228_0910_dicom\T1_biobank_normal_5
INFO: searching files for dicom, series 5
INFO: search time 9.1891 sec
INFO: Found 208 files in series 5
Loading dicom info foreach file
Loading data from each file.
Warning: the estimated units are not very decisive, assuming that the units are "mm"
mri =
dim: [256 256 208]
anatomy: [256×256×208 double]
hdr: [1×208 struct]
transform: [4×4 double]
unit: 'mm'
The 208 dicom files are each a 256x256 size sagittal MRI slice. The anatomy field which is made up of all the slices has a diminution of 256x256x208. The header field ('hdr') contains information about the MRI scan.
If you plot the new 'mri' structure, the picture appears to be flipped.
ft_sourceplot([], mri);
the input is volume data with dimensions [256 256 208]
scaling anatomy to [0 1]
not plotting functional data
not applying a mask on the functional data
not using an atlas
not using a region-of-interest
Warning: no colorbar possible without functional data
click left mouse button to reposition the cursor
click and hold right mouse button to update the position while moving the mouse
use the arrowkeys to navigate in the current axis
the call to "ft_sourceplot" took 1 seconds
To fix the orientation we can use the ft_volumereslice function.
mri_reslice=ft_volumereslice([],mri)
the input is volume data with dimensions [256 256 208]
reslicing from [256 256 208] to [256 256 256]
the input is volume data with dimensions [256 256 256]
the input is volume data with dimensions [256 256 208]
selecting subvolume of 62.1%
reslicing and interpolating anatomy
inteinterpolating 100.0
the call to "ft_sourceinterpolate" took 6 seconds
the call to "ft_volumereslice" took 6 seconds
mri_reslice =
anatomy: [256×256×256 double]
dim: [256 256 256]
transform: [4×4 double]
unit: 'mm'
cfg: [1×1 struct]
Plot the resliced mri structure:
ft_sourceplot([], mri_reslice);
the input is volume data with dimensions [256 256 256]
scaling anatomy to [0 1]
not plotting functional data
not applying a mask on the functional data
not using an atlas
not using a region-of-interest
Warning: no colorbar possible without functional data
click left mouse button to reposition the cursor
click and hold right mouse button to update the position while moving the mouse
use the arrowkeys to navigate in the current axis
the call to "ft_sourceplot" took 0 seconds
ft_volumreslice realigned the volume so it does not appear to be flipped anymore, and also made the volume symmetrical across the 3 dimensions. Thus the anatomy field now is a 256x256x256 matrix.
Next we will read the digitized headshape and landmark points of the Polhemus digitization which was part of the MEG recording.
headshape=ft_read_headshape(megfile)
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
306 MEG channel locations transformed
Reading training_raw-1.fif ...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Opening raw data file training_raw-1.fif...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Range : 208000 ... 1664999 = 208.000 ... 1664.999 secs
Ready.
headshape =
pos: [400×3 double]
fid: [1×1 struct]
label: {400×1 cell}
coordsys: 'neuromag'
unit: 'cm'
Read the channel information in and plot the landmark points, additional digitized headpoints and the channels.
grad=ft_read_sens(megfile,'senstype','meg');
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
306 MEG channel locations transformed
Reading training_raw-1.fif ...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Opening raw data file training_raw-1.fif...
Read a total of 8 projection items:
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
generated with autossp-1.2.0 (1 x 306) idle
Range : 208000 ... 1664999 = 208.000 ... 1664.999 secs
Ready.
Plot the headshape points and the sensors:
ft_plot_headshape(headshape);
Now coregister the MRI scan with the MEG recording by bringing the MRI scan to Neuromag coordinate system, same the MEG recording. To do so you will need to mark the cardinal landmark points (LPA, RPA and nasion) on the MRI scan by running the ft_volumerealign function. Fieldtrip will then bring the scan to Neuromag coordinates ('cfg.coordsys='neuromag).
cfg.method='interactive';
mri_realigned1=ft_volumerealign(cfg,mri_reslice)
the input is volume data with dimensions [256 256 256]
1. To change the slice viewed in one plane, either:
a. click (left mouse) in the image on a different plane. Eg, to view a more
superior slice in the horizontal plane, click on a superior position in the
coronal plane, or
b. use the arrow keys to increase or decrease the slice number by one
2. To mark a fiducial position or anatomical landmark, do BOTH:
a. select the position by clicking on it in any slice with the left mouse button
b. identify it by pressing the letter corresponding to the fiducial/landmark:
press n for nas, l for lpa, r for rpa
press z for an extra control point that should have a positive z-value
You can mark the fiducials multiple times, until you are satisfied with the positions.
3. To change the display:
a. press c on keyboard to toggle crosshair visibility
b. press f on keyboard to toggle fiducial visibility
c. press + or - on (numeric) keyboard to change the color range's upper limit
4. To finalize markers and quit interactive mode, press q on keyboard
Warning: assuming that the units are "mm"
Warning: assuming that the units are "mm"
Warning: assuming that the units are "mm"
the call to "ft_volumerealign" took 115 seconds
mri_realigned1 =
anatomy: [256×256×256 double]
dim: [256 256 256]
transform: [4×4 double]
unit: 'mm'
cfg: [1×1 struct]
transformorig: [4×4 double]
coordsys: 'neuromag'
After running the function an interactive figure will pop up. You will need to find the left preauricular (LPA), the right preauricular point (RPA) and the nasion on the scan and press l,p and n, respectively. This will tell where these landmarks are on the scan and so Fieldtrip will translate the scan into the Neuromag coordinate system according to the marked points.
The new structure has a new field ('coordys'), which suggests that the scan is now in Neuromag coordinates.
Have a look at the realigned MRI plot.
ft_sourceplot([], mri_realigned1);
the input is volume data with dimensions [256 256 256]
scaling anatomy to [0 1]
not plotting functional data
not applying a mask on the functional data
not using an atlas
not using a region-of-interest
Warning: no colorbar possible without functional data
click left mouse button to reposition the cursor
click and hold right mouse button to update the position while moving the mouse
use the arrowkeys to navigate in the current axis
the call to "ft_sourceplot" took 1 seconds
Next we will plot the landmark points, the additional headpoints in conjunction with the anatomical scan. To do so first we will need to bring the MRI scan and the headpoints to the same measurement unit ('cm') as the headpoints.
headshape=ft_convert_units(headshape,'cm');
mri_realigned1=ft_convert_units(mri_realigned1,'cm');
Next we need to extract the coordinates of the landmark points:
nas = ft_warp_apply(mri_realigned1.transform, [mri_realigned1.cfg.fiducial.nas]);%, mri_realigned1.cfg.fiducial.lpa, mri_realigned1.cfg.fiducial.rpa, 'neuromag')
lpa = ft_warp_apply(mri_realigned1.transform, [mri_realigned1.cfg.fiducial.lpa]);%, mri_realigned1.cfg.fiducial.lpa, mri_realigned1.cfg.fiducial.rpa, 'neuromag')
rpa = ft_warp_apply(mri_realigned1.transform, [mri_realigned1.cfg.fiducial.rpa]);%, mri_realigned1.cfg.fiducial.lpa, mri_realigned1.cfg.fiducial.rpa, 'neuromag')
Now we can plot:
ft_determine_coordsys(mri_realigned1,'interactive','no')
The positive x-axis is pointing towards the right
The positive y-axis is pointing towards anterior
The positive z-axis is pointing towards superior
The axes are 15 cm long in each direction
The diameter of the sphere at the origin is 1 cm
ans =
anatomy: [256×256×256 double]
dim: [256 256 256]
transform: [4×4 double]
unit: 'cm'
cfg: [1×1 struct]
transformorig: [4×4 double]
coordsys: 'neuromag'
ft_plot_headshape(headshape);
plot3(nas(1,1), nas(1,2), nas(1,3), 'm*');
plot3(lpa(1,1), lpa(1,2), lpa(1,3), 'm*');
plot3(rpa(1,1), rpa(1,2), rpa(1,3), 'm*');
To fin-tune the alignment between the MRI scan and the MEG recording, we call ft_volumrealignment function in once more, but with 'headshape method. By doing so we can align the MRI headsurface to the digitized additional headpoints and cardinal landmark points. You will need to modify the rotate, scale and translate values to make adjustments.
cfg.headshape.headshape=headshape;
mri_realigned2 =ft_volumerealign(cfg,mri_realigned1);
the input is volume data with dimensions [256 256 256]
the input is volume data with dimensions [256 256 256]
creating scalpmask ... using the anatomy field for segmentation
smoothing anatomy with a 2-voxel FWHM kernel
thresholding anatomy at a relative threshold of 0.100
the call to "ft_volumesegment" took 5 seconds
triangulating the outer boundary of compartment 1 (scalp) with 20000 vertices
the call to "ft_prepare_mesh" took 3 seconds
doing interactive realignment with headshape
Use the mouse to rotate the geometry, and click "redisplay" to update the light.
Close the figure when you are done.
this returns a light skin, you can also explicitly specify 'skin_light',' skin_medium_light', 'skin_medium', 'skin_medium_dark', or 'skin_dark'
the template coordinate system is "neuromag"
the positive X-axis is pointing to the right
the positive Y-axis is pointing to anterior
the positive Z-axis is pointing to superior
the call to "ft_interactiverealign" took 106 seconds
doing iterative closest points realignment with headshape
the input is mesh data with 20000 vertices and 39996 triangles
the input is source data with 20000 brainordinates
the input is source data with 379 brainordinates
interpolating distance
the call to "ft_sourceinterpolate" took 2 seconds
the input is mesh data with 20000 vertices and 39996 triangles
the input is source data with 20000 brainordinates
the input is source data with 379 brainordinates
interpolating distance
the call to "ft_sourceinterpolate" took 2 seconds
the call to "ft_volumerealign" took 118 seconds
Forward model
To create the forward model, first we need to distinguish parts of the MRI scan which represent the brain and others outside of it. For this purpose we can use the ft_volumesegment function, which will be using the external SPM toolbox to perform the segmentation.
NOTE: you may also want to also specify the skull and scalp, especially if you are using EEG.
mri_segm=ft_volumesegment(cfg,mri_realigned2)
the input is volume data with dimensions [256 256 256]
using 'OldNorm' normalisation
Smoothing by 0 & 8mm..
Coarse Affine Registration..
Warning: Using 'state' to set RAND's internal state causes RAND, RANDI, and RANDN to use legacy random number generators. This syntax is not recommended. See Replace Discouraged Syntaxes of rand and randn to use RNG to replace the old syntax.
Fine Affine Registration..
performing the segmentation on the specified volume, using the old-style segmentation
SPM12: spm_preproc (v4916) 13:34:14 - 21/09/2021
========================================================================
Completed : 13:37:13 - 21/09/2021
creating brainmask ... using the summation of gray, white and csf tpms
smoothing brainmask with a 5-voxel FWHM kernel
thresholding brainmask at a relative threshold of 0.500
the call to "ft_volumesegment" took 228 seconds
mri_segm =
dim: [256 256 256]
transform: [4×4 double]
coordsys: 'neuromag'
unit: 'cm'
brain: [256×256×256 logical]
cfg: [1×1 struct]
The output structure 'mri_segm' has a new field 'brain'. This field is a logical matrix having only zeros and ones, indicating parts of the scan that are not part of the brain and those that are, respectively.
Plot the results:
cfg.funparameter = 'brain';
ft_sourceplot(cfg, mri_segm);
the input is segmented volume data with dimensions [256 256 256]
the volume of each of the segmented compartments is
brain : 1903 ml ( 11.35 %)
total segmented : 1903 ml ( 11.35 %)
total volume : 16777 ml (100.00 %)
Warning: converting functional data to double precision
not plotting anatomy
not applying a mask on the functional data
not using an atlas
not using a region-of-interest
click left mouse button to reposition the cursor
click and hold right mouse button to update the position while moving the mouse
use the arrowkeys to navigate in the current axis
the call to "ft_sourceplot" took 1 seconds
Next we will create the boundaries of the volume that belong to the brain with the ft_prepare_headmodel function.
cfg.method='singleshell';
headmodel=ft_prepare_headmodel(cfg,mri_segm);
triangulating the outer boundary of compartment 1 (brain) with 3000 vertices
the call to "ft_prepare_mesh" took 2 seconds
the call to "ft_prepare_headmodel" took 2 seconds
headmodel=ft_convert_units(headmodel,'cm');
Plot the headmodel together with the channels and the digitized headshape points.
ft_plot_headshape(headshape);
ft_plot_headmodel(headmodel);
Now calculate the forward model by discretizing the brain volume into gridpoints and calculating the leadfield matrix. Here we will have gridpoints half a centimeter apart.
cfg.channel=planar_ica.label;
grid=ft_prepare_leadfield(cfg);
Warning: use cfg.sourcemodel instead of cfg.grid
Warning: The field cfg.sourcemodel.resolution is deprecated, pleae use cfg.resolution
using gradiometers specified in the configuration
computing surface normals
creating sourcemodel based on automatic 3D grid with specified resolution
using gradiometers specified in the configuration
creating 3D grid with 0.5 cm resolution
initial 3D grid dimensions are [37 43 35]
14893 dipoles inside, 40792 dipoles outside brain
making tight grid
14893 dipoles inside, 15557 dipoles outside brain
the call to "ft_prepare_sourcemodel" took 9 seconds
computing leadfield
computing leadfield 14893/14893
the call to "ft_prepare_leadfield" took 88 seconds
Plot the gridpoints and the channels.
ft_plot_sens(grad, 'style', '*b');
ft_plot_headmodel(headmodel, 'edgecolor', 'none'); alpha 0.4;
ft_plot_mesh(grid.pos(grid.inside,:));
Inverse model
Replace the grad structure in the to-be analysed data with the 'grad' structure we read in with ft_read_sens. This is because of some minor issues with some of the Fieldtrip versions, which could couse some problems further down the line.
Select the 'attend left' and 'attend right' trials.
idx=(find(planar_ica.trialinfo==21))';
data_left=ft_selectdata(cfg,planar_ica);
the call to "ft_selectdata" took 0 seconds
idx=(find(planar_ica.trialinfo==22))';
data_right=ft_selectdata(cfg,planar_ica);
the call to "ft_selectdata" took 0 seconds
Select the time-period within each trial you want to source localize. In this case this will be the half a second prior to the grating onset, to see the sources of pre-target lateralized alpha power difference we have seen in the sensor-level TFR analysis.
data_left_sh=ft_selectdata(cfg,data_left);
the call to "ft_selectdata" took 1 seconds
data_right_sh=ft_selectdata(cfg,data_right);
the call to "ft_selectdata" took 0 seconds
For the source localization with beamforming we will need to create the spatial filter on data with both 'attend left' and 'attend right' trials. Hence create a combined data structure with both condition trials included with ft_appenddata.
data_sh_cmb=ft_appenddata([], data_left_sh,data_right_sh);
concatenating over the "rpt" dimension
the call to "ft_selectdata" took 0 seconds
the call to "ft_appenddata" took 0 seconds
Run ft_frequencyanalysis for the frequency decomposition of the 'attend left', 'attend right' and the combined data at 10Hz.
cfg.output = 'powandcsd';
freq_left_sh=ft_freqanalysis(cfg, data_left_sh);
the input is raw data with 203 channels and 147 trials
Warning: sampleinfo in the configuration is inconsistent with the actual data
Warning: reconstructing sampleinfo by assuming that the trials are consecutive segments of a continuous recording
the call to "ft_selectdata" took 0 seconds
Default cfg.pad='maxperlen' can run slowly. Consider using cfg.pad='nextpow2' for more efficient FFT computation.
processing trials
processing trial 147/147 nfft: 501 samples, datalength: 501 samples, 1 tapers
the call to "ft_freqanalysis" took 1 seconds
freq_right_sh=ft_freqanalysis(cfg, data_right_sh);
the input is raw data with 203 channels and 140 trials
Warning: sampleinfo in the configuration is inconsistent with the actual data
Warning: reconstructing sampleinfo by assuming that the trials are consecutive segments of a continuous recording
the call to "ft_selectdata" took 0 seconds
Default cfg.pad='maxperlen' can run slowly. Consider using cfg.pad='nextpow2' for more efficient FFT computation.
processing trials
processing trial 140/140 nfft: 501 samples, datalength: 501 samples, 1 tapers
the call to "ft_freqanalysis" took 1 seconds
freq_sh_cmb=ft_freqanalysis(cfg,data_sh_cmb);
the input is raw data with 203 channels and 287 trials
Warning: sampleinfo in the configuration is inconsistent with the actual data
Warning: reconstructing sampleinfo by assuming that the trials are consecutive segments of a continuous recording
the call to "ft_selectdata" took 0 seconds
Default cfg.pad='maxperlen' can run slowly. Consider using cfg.pad='nextpow2' for more efficient FFT computation.
processing trials
processing trial 287/287 nfft: 501 samples, datalength: 501 samples, 1 tapers
the call to "ft_freqanalysis" took 2 seconds
Run the source reconstruction with 'DICS' beamforming by running ft_sourceanalysis on the combined data. Then use the spatial filter obtained via the combined data and use it for the source reconstruction with the 'attend left' and 'attend right' trials.
cfg.frequency=freq_sh_cmb.freq;
cfg.dics.projectnoise='yes';
cfg.dics.keepfilter = 'yes';
cfg.dics.realfilter = 'yes';
cfg.dics.fixedori = 'yes';
source_cmb=ft_sourceanalysis(cfg,freq_sh_cmb);
the input is freq data with 203 channels, 1 frequencybins and no timebins
the call to "ft_selectdata" took 0 seconds
converting the linearly indexed channelcombinations into a square CSD-matrix
using precomputed leadfields
the call to "ft_selectdata" took 0 seconds
using precomputed leadfields
scanning grid
scanning grid 14893/14893
the call to "ft_sourceanalysis" took 4 seconds
cfg.sourcemodel.filter=source_cmb.avg.filter;
source_left=ft_sourceanalysis(cfg,freq_left_sh);
the input is freq data with 203 channels, 1 frequencybins and no timebins
the call to "ft_selectdata" took 0 seconds
converting the linearly indexed channelcombinations into a square CSD-matrix
using precomputed filters, not computing any leadfields
the call to "ft_selectdata" took 0 seconds
Warning: with precomputed spatial filters a fixed orientation constraint or weight normalisation options are not applied
using precomputed filters
scanning grid
scanning grid 14893/14893
the call to "ft_sourceanalysis" took 2 seconds
source_right=ft_sourceanalysis(cfg,freq_right_sh);
the input is freq data with 203 channels, 1 frequencybins and no timebins
the call to "ft_selectdata" took 0 seconds
converting the linearly indexed channelcombinations into a square CSD-matrix
using precomputed filters, not computing any leadfields
the call to "ft_selectdata" took 0 seconds
Warning: with precomputed spatial filters a fixed orientation constraint or weight normalisation options are not applied
using precomputed filters
scanning grid
scanning grid 14893/14893
the call to "ft_sourceanalysis" took 2 seconds
Calculate the relative power difference between 'attend left' and 'attend right' trials on source level.
source_con_pos1=source_left;
source_con_pos1.avg.pow=(source_left.avg.pow-source_right.avg.pow)./(source_left.avg.pow+source_right.avg.pow);
source_con_pos2=source_left;
source_con_pos2.avg.pow=(source_right.avg.pow-source_left.avg.pow)./(source_left.avg.pow+source_right.avg.pow);
Interpolate the difference on the MRI scan for later plotting.
cfg.interpmethod ='nearest';
source_conint_pos1=ft_sourceinterpolate(cfg,source_con_pos1,mri_realigned2);
Warning: use cfg.parameter='pow' instead of cfg.parameter='avg.pow'
the input is volume data with dimensions [256 256 256]
the input is source data with 30450 brainordinates on a [30 35 29] grid
could not reshape "cumtapcnt" to the dimensions of the volume
could not reshape "freq" to the dimensions of the volume
selecting subvolume of 20.6%
interpolatininterpolating 100.0
reslicing and interpolating pow
interpolatininterpolating 100.0
the call to "ft_sourceinterpolate" took 7 seconds
source_conint_pos2=ft_sourceinterpolate(cfg,source_con_pos2,mri_realigned2);
Warning: use cfg.parameter='pow' instead of cfg.parameter='avg.pow'
the input is volume data with dimensions [256 256 256]
the input is source data with 30450 brainordinates on a [30 35 29] grid
could not reshape "cumtapcnt" to the dimensions of the volume
could not reshape "freq" to the dimensions of the volume
selecting subvolume of 20.6%
interpolatininterpolating 100.0
reslicing and interpolating pow
interpolatininterpolating 100.0
the call to "ft_sourceinterpolate" took 8 seconds
Plot the results.
cfg.maskparameter=cfg.funparameter;
ft_sourceplot(cfg,source_conint_pos1);
the input is source data with 16777216 brainordinates on a [256 256 256] grid
the call to "ft_selectdata" took 0 seconds
scaling anatomy to [0 1]
not using an atlas
not using a region-of-interest
click left mouse button to reposition the cursor
click and hold right mouse button to update the position while moving the mouse
use the arrowkeys to navigate in the current axis
the call to "ft_sourceplot" took 16 seconds
To also plot the results on the cortical surface we first need to normalize the source localization results.
source_conint_pos1_norm = ft_volumenormalise(cfg, source_conint_pos1);
the input is source data with 16777216 brainordinates on a [256 256 256] grid
could not reshape "freq" to the dimensions of the volume
Using default SPM template 'C:\Toolboxes\spm12\spm12\toolbox\OldNorm\T1.nii'
Doing initial alignment...
Warning: Not applying any scaling, using 'acpc' instead of 'spm'. See http://bit.ly/2sw7eC4
Smoothing by 0 & 8mm..
Coarse Affine Registration..
Fine Affine Registration..
writing anatomy to disk
writing pow to disk
writing inside to disk
Performing the parameter estimation
Warping the individual anatomy to the template anatomy, using only linear transformations
Smoothing by 0 & 8mm..
Coarse Affine Registration..
Fine Affine Registration..
creating the normalized volumes
SPM12: spm_write_sn (v4878) 14:27:15 - 21/09/2021
========================================================================
Completed : 14:27:18 - 21/09/2021
the call to "ft_volumenormalise" took 15 seconds
source_conint_pos2_norm = ft_volumenormalise(cfg, source_conint_pos2);
the input is source data with 16777216 brainordinates on a [256 256 256] grid
could not reshape "freq" to the dimensions of the volume
Using default SPM template 'C:\Toolboxes\spm12\spm12\toolbox\OldNorm\T1.nii'
Doing initial alignment...
Warning: Not applying any scaling, using 'acpc' instead of 'spm'. See http://bit.ly/2sw7eC4
Smoothing by 0 & 8mm..
Coarse Affine Registration..
Fine Affine Registration..
writing anatomy to disk
writing pow to disk
writing inside to disk
Performing the parameter estimation
Warping the individual anatomy to the template anatomy, using only linear transformations
Smoothing by 0 & 8mm..
Coarse Affine Registration..
Fine Affine Registration..
creating the normalized volumes
SPM12: spm_write_sn (v4878) 14:27:29 - 21/09/2021
========================================================================
Completed : 14:27:33 - 21/09/2021
the call to "ft_volumenormalise" took 14 seconds
Plot the results.
cfg.funparameter = 'pow';
cfg.maskparameter = cfg.funparameter;
cfg.funcolorlim = [0.1 0.2];
cfg.opacitylim = [0.1 0.2];
cfg.opacitymap = 'rampup';
cfg.projmethod = 'nearest';
cfg.surffile = 'surface_white_both.mat';
ft_sourceplot(cfg, source_conint_pos1_norm);
the input is volume data with dimensions [181 217 181]
scaling anatomy to [0 1]
not using an atlas
not using a region-of-interest
The source functional is defined on a 3D grid, interpolation to a surface mesh will be performed
downsampling surface from 346499 vertices
7109137 voxels in functional data
34653 vertices in cortical surface
the input is mesh data with 34653 vertices and 69298 triangles
the input is parcellated source data with 34653 brainordinates
the input is volume data with dimensions [181 217 181]
interpolating pow
interpolating pow
the call to "ft_sourceinterpolate" took 3 seconds
the call to "ft_sourceplot" took 9 seconds